package base.方法引用;

import java.util.ArrayList;
import java.util.Arrays;

public class 练习_2 {
    public static void main(String[] args) {
        /*2、只获取姓名并放到数组当中（方法引用）*/

        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student("王五",25));
        list.add(new Student("赵六",35));

        String[] arr = list.stream().map(Student::getName).toArray(String[]::new);
        System.out.println(Arrays.toString(arr));
    }
}
